//============================================================================
// Name        : ex02.cpp
// Author      : Jordan Gray
// Copyright   : MIT
// Description : Stroustrup's The C++ Programming Language, exercise 02
//============================================================================


#include <iostream>
#include <sstream>
#include "string.h"

ch11ex02::String f(ch11ex02::String a, ch11ex02::String b) {
  a[2] = 'x';
  char c = b[3];
  std::cout << "in f: " << a << ' ' << b << ' ' << c << '\n';
  return b;
}

int main() {
  using ch11ex02::String;
  using std::cin;
  using std::cout;

  String x,y;
  cout << "Please enter two strings\n";
  cin >> x >> y;
  cout << "input: " << x << ' ' << y << '\n';
  String z = x;
  y = f(x,y);
  if (x != z) cout << "x corrupted!\n";
  x[0] = '!';
  if (x==z) cout << "write failed!\n";
  cout << "exit: " << x << ' ' << y << ' ' << z << '\n';
	return 0;
}
